package com.xuan.yupao.exception;

import com.xuan.yupao.common.ErrorCode;
import lombok.Getter;

@Getter
public class BusinessException extends RuntimeException{

    /*
        错误码
     */
    private final Integer code;
    /*
        错误码描述(详细)
     */
    private final String description;



    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getErrorMessage());
        this.code = errorCode.getCode();
        description = errorCode.getDescription();
    }

    public BusinessException(ErrorCode errorCode, String description) {
        super(errorCode.getErrorMessage());
        this.code = errorCode.getCode();
        this.description = description;
    }
}
